package org.example.backend.repository;

import org.example.backend.entity.Ticket;
import org.example.backend.entity.TicketOrder;
import org.example.backend.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.time.LocalDate;
import java.util.Optional;

public interface TicketOrderRepository extends JpaRepository<TicketOrder, Long> {
    Page<TicketOrder> findByUser(User user, Pageable pageable);
    Optional<TicketOrder> findByIdAndUser(Long id, User user);
    Page<TicketOrder> findByVisitDateBetween(LocalDate startDate, LocalDate endDate, Pageable pageable);
    boolean existsByTicketAndVisitDateGreaterThanEqual(Ticket ticket, LocalDate date);
} 